package com.qiangesoft.easyexcel.write;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.converters.string.StringImageConverter;
import com.alibaba.excel.metadata.data.WriteCellData;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import java.io.File;
import java.io.InputStream;
import java.net.URL;

/**
 * 图片导出类
 *
 * @author qiangesoft
 * @date 2024-04-10
 */
@Getter
@Setter
@EqualsAndHashCode
@ContentRowHeight(100)
@ColumnWidth(100 / 8)
public class ImageWriteData {

    @ExcelProperty("文件")
    private File file;

    @ExcelProperty("输入流")
    private InputStream inputStream;

    /**
     * 如果string类型 必须指定转换器，string默认转换成string
     */
    @ExcelProperty(value = "字符串", converter = StringImageConverter.class)
    private String string;

    @ExcelProperty("字节")
    private byte[] byteArray;

    @ExcelProperty("url")
    private URL url;

    @ExcelProperty("自定义")
    private WriteCellData<Void> writeCellDataFile;
}
